package com.spring.boot.controller;

import com.spring.boot.service.CollectAndPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author: ZTQ
 * @Date: 2021/01/01 17:26
 * @Description: TODO 日结账管理 控制器
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/collectAndPay")
public class CollectAndPayController {
    @Autowired
    private CollectAndPayService collectAndPayService;
    /**
     * @param date 日期
     * @description: 查询日结账
     */
    @GetMapping(value = "/findCollectAndPayByDate", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map<String, Object> findCollectAndPayByDate(@RequestParam String date) {
        //调用合同service层的findCollectAndPayByDate方法，进行查询日结账信息
        Map<String, Object> collectAndPayByDate = collectAndPayService.findCollectAndPayByDate(date);
        //返回数据信息
        return collectAndPayByDate;
    }

    /**
     * @param
     * @description: 统计
     */
    @GetMapping(value = "/getStatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map<String, Object> getStatistics() {
        //调用合同service层的Statistics方法，进行查询统计数据信息
        Map<String, Object> statistics = collectAndPayService.Statistics();
        //返回数据信息
        return statistics;
    }

}
